package cn.iocoder.yudao.module.dt.dal.mysql.activity;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.dt.dal.dataobject.activity.ActivityDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.dt.controller.admin.activity.vo.*;

/**
 * 活动 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ActivityMapper extends BaseMapperX<ActivityDO> {

    default PageResult<ActivityDO> selectPage(ActivityPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ActivityDO>()
                .eqIfPresent(ActivityDO::getTitle, reqVO.getTitle())
                .eqIfPresent(ActivityDO::getType, reqVO.getType())
                .eqIfPresent(ActivityDO::getContent, reqVO.getContent())
                .betweenIfPresent(ActivityDO::getSignStartTime, reqVO.getSignStartTime())
                .betweenIfPresent(ActivityDO::getSignEndTime, reqVO.getSignEndTime())
                .eqIfPresent(ActivityDO::getCoverPic, reqVO.getCoverPic())
                .betweenIfPresent(ActivityDO::getStartTime, reqVO.getStartTime())
                .betweenIfPresent(ActivityDO::getEndTime, reqVO.getEndTime())
                .eqIfPresent(ActivityDO::getTotalNumber, reqVO.getTotalNumber())
                .eqIfPresent(ActivityDO::getStartNumber, reqVO.getStartNumber())
                .eqIfPresent(ActivityDO::getSubmitNumber, reqVO.getSubmitNumber())
                .eqIfPresent(ActivityDO::getLineNumber, reqVO.getLineNumber())
                .eqIfPresent(ActivityDO::getPosNo, reqVO.getPosNo())
                .eqIfPresent(ActivityDO::getActForm, reqVO.getActForm())
                .eqIfPresent(ActivityDO::getActAddress, reqVO.getActAddress())
                .eqIfPresent(ActivityDO::getActViewAuthority, reqVO.getActViewAuthority())
                .eqIfPresent(ActivityDO::getActShareAuthority, reqVO.getActShareAuthority())
                .eqIfPresent(ActivityDO::getCancelManage, reqVO.getCancelManage())
                .betweenIfPresent(ActivityDO::getCancelTime, reqVO.getCancelTime())
                .eqIfPresent(ActivityDO::getEditManage, reqVO.getEditManage())
                .eqIfPresent(ActivityDO::getQuickFill, reqVO.getQuickFill())
                .eqIfPresent(ActivityDO::getSubmitListShow, reqVO.getSubmitListShow())
                .eqIfPresent(ActivityDO::getSubmitBeforeShow, reqVO.getSubmitBeforeShow())
                .eqIfPresent(ActivityDO::getSubmitAfterShow, reqVO.getSubmitAfterShow())
                .eqIfPresent(ActivityDO::getSponsorShow, reqVO.getSponsorShow())
                .eqIfPresent(ActivityDO::getActFee, reqVO.getActFee())
                .eqIfPresent(ActivityDO::getActMemberFee, reqVO.getActMemberFee())
                .eqIfPresent(ActivityDO::getActTeamFee, reqVO.getActTeamFee())
                .eqIfPresent(ActivityDO::getFeeType, reqVO.getFeeType())
                .eqIfPresent(ActivityDO::getFeeIsAa, reqVO.getFeeIsAa())
                .eqIfPresent(ActivityDO::getSubmitAuthority, reqVO.getSubmitAuthority())
                .eqIfPresent(ActivityDO::getSignCount, reqVO.getSignCount())
                .eqIfPresent(ActivityDO::getSponsorId, reqVO.getSponsorId())
                .betweenIfPresent(ActivityDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ActivityDO::getId));
    }

    default List<ActivityDO> selectList(ActivityExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ActivityDO>()
                .eqIfPresent(ActivityDO::getTitle, reqVO.getTitle())
                .eqIfPresent(ActivityDO::getType, reqVO.getType())
                .eqIfPresent(ActivityDO::getContent, reqVO.getContent())
                .betweenIfPresent(ActivityDO::getSignStartTime, reqVO.getSignStartTime())
                .betweenIfPresent(ActivityDO::getSignEndTime, reqVO.getSignEndTime())
                .eqIfPresent(ActivityDO::getCoverPic, reqVO.getCoverPic())
                .betweenIfPresent(ActivityDO::getStartTime, reqVO.getStartTime())
                .betweenIfPresent(ActivityDO::getEndTime, reqVO.getEndTime())
                .eqIfPresent(ActivityDO::getTotalNumber, reqVO.getTotalNumber())
                .eqIfPresent(ActivityDO::getStartNumber, reqVO.getStartNumber())
                .eqIfPresent(ActivityDO::getSubmitNumber, reqVO.getSubmitNumber())
                .eqIfPresent(ActivityDO::getLineNumber, reqVO.getLineNumber())
                .eqIfPresent(ActivityDO::getPosNo, reqVO.getPosNo())
                .eqIfPresent(ActivityDO::getActForm, reqVO.getActForm())
                .eqIfPresent(ActivityDO::getActAddress, reqVO.getActAddress())
                .eqIfPresent(ActivityDO::getActViewAuthority, reqVO.getActViewAuthority())
                .eqIfPresent(ActivityDO::getActShareAuthority, reqVO.getActShareAuthority())
                .eqIfPresent(ActivityDO::getCancelManage, reqVO.getCancelManage())
                .betweenIfPresent(ActivityDO::getCancelTime, reqVO.getCancelTime())
                .eqIfPresent(ActivityDO::getEditManage, reqVO.getEditManage())
                .eqIfPresent(ActivityDO::getQuickFill, reqVO.getQuickFill())
                .eqIfPresent(ActivityDO::getSubmitListShow, reqVO.getSubmitListShow())
                .eqIfPresent(ActivityDO::getSubmitBeforeShow, reqVO.getSubmitBeforeShow())
                .eqIfPresent(ActivityDO::getSubmitAfterShow, reqVO.getSubmitAfterShow())
                .eqIfPresent(ActivityDO::getSponsorShow, reqVO.getSponsorShow())
                .eqIfPresent(ActivityDO::getActFee, reqVO.getActFee())
                .eqIfPresent(ActivityDO::getActMemberFee, reqVO.getActMemberFee())
                .eqIfPresent(ActivityDO::getActTeamFee, reqVO.getActTeamFee())
                .eqIfPresent(ActivityDO::getFeeType, reqVO.getFeeType())
                .eqIfPresent(ActivityDO::getFeeIsAa, reqVO.getFeeIsAa())
                .eqIfPresent(ActivityDO::getSubmitAuthority, reqVO.getSubmitAuthority())
                .eqIfPresent(ActivityDO::getSignCount, reqVO.getSignCount())
                .eqIfPresent(ActivityDO::getSponsorId, reqVO.getSponsorId())
                .betweenIfPresent(ActivityDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ActivityDO::getId));
    }

}
